package com.zzqstart.cateservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zzqstart.cateservice.entity.CateRecipeCollect;
import com.zzqstart.cateservice.mapper.CateRecipeCollectMapper;
import com.zzqstart.cateservice.service.CateRecipeCollectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author testjava
 * @since 2023-03-06
 */
@Service
public class CateRecipeCollectServiceImpl extends ServiceImpl<CateRecipeCollectMapper, CateRecipeCollect> implements CateRecipeCollectService {

    @Override
    public List<String> getRecipeIdListBymemberId(String memberId) {
        QueryWrapper<CateRecipeCollect> wrapper = new QueryWrapper<>();
        wrapper.eq("member_id",memberId);
        List<CateRecipeCollect> list = baseMapper.selectList(wrapper);
        ArrayList<String> result = new ArrayList<>();
        for (CateRecipeCollect cateRecipeCollect: list) {
            String recipeId = cateRecipeCollect.getRecipeId();
            result.add(recipeId);
        }
        return result;
    }
}
